$(function () {
    var table=document.getElementById("tbody-result");
    $.ajax({
        type:'GET',
        dataType:'json',
        url:contextPath+"all/depend",
        success:function (data) {
            console.log(data);
            var str="";
            for (var i=0;i<data.count;i++) {
                str+="<tr>" +
                    "<td>" + i + "</td>" +
                    "<td>" + data.list[i].name + "</td>" +
                    "<td><button onclick='chuan(this)'>查看关联小类</button></td>"
                    "</tr>"
            }
            table.innerHTML=str;
        },
        error:function () {
            alert("查询失败")
        }
    })
});
function chuan(r) {
    var table =window.document.getElementById("tbody-result");
    var i= r.parentNode.parentNode.rowIndex-1;
    var ss =new Object();
    ss.name=table.rows[i].cells[1].innerHTML;
    window.location.href="relateQuery.html?name="+ss.name;
}